package P3.T05;

import java.util.Iterator;

public class Cat implements Iterable<Integer>{
    private String name;
    private int huzi;

    public Cat(String name, int huzi) {
        this.name = name;
        this.huzi = huzi;
    }

    @Override
    public Iterator<Integer> iterator() {
        return new HuziIterator();
    }

    private class HuziIterator implements Iterator<Integer> {
        private int pos=1;
        @Override
        public boolean hasNext() {
            return pos<=huzi;
        }

        @Override
        public Integer next() {
            int curpos=pos;
            pos++;
            return curpos;
        }
    }
}
